/*
 * @(#) UserInfoServiceImpl.java 1.0  2011-8-5 
 *
 * (c) Copyright 2011 smshen S3H3L3
 *
 * FILENAME    : UserInfoServiceImpl.java
 * PACKAGE     : com.sm.service.impl
 * CREATE DATE : 2011-8-5
 * AUTHOR      : smshen
 */

package com.sm.service.impl;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sm.dao.UserInfoDao;
import com.sm.model.UserInfo;
import com.sm.service.UserInfoService;

/*******************************************************************************
 *  #(c) smshen S3H3L3 
 *
 *  功能说明: 
  
 *  2011-8-5 下午1:43:09 smshen 创建文件
 * 
 *  修改说明: 创建文件

 *  2011-8-5 下午1:43:09 smshen 修改文件
 * 
 ******************************************************************************/

@Service
public class UserInfoServiceImpl implements UserInfoService {
	
	/**
	 * 用户DAO
	 */
	@Autowired
	private UserInfoDao userInfoDao;
	
	@Override
	public UserInfo getUserInfoById(String id) {
		return userInfoDao.getUserInfoById(id);
	}

	@Override
	public UserInfo findUserInfoByNameAndPasswd(String userName, String password) {
		return userInfoDao.findUserInfoByNameAndPasswd(userName, password);
	}

	@Override
	public Map<String, Boolean> checkUserIsExist(String userName) {
		Map<String, Boolean> map = new HashMap<String, Boolean>();
		UserInfo userInfo = userInfoDao.checkUserIsExist(userName);
		if (userInfo != null) {
			map.put("data", true);
		} else {
			map.put("data", false);
		}
		return map;
	}

	@Override
	public void addUser(UserInfo userInfo) {
		userInfoDao.addUser(userInfo);
	}

	@Override
	public String getAllUserList(HttpServletRequest request) {
		return userInfoDao.getAllUserList(request);
	}

	@Override
	public void delUser(String id) {
		userInfoDao.delUser(id);
	}

	@Override
	public void updateAndSaveUser(UserInfo userInfo) {
		userInfoDao.updateAndSaveUser(userInfo);
	}

}


